﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ObjectModel;
using System.Globalization;
using System.Reflection;

namespace SAIPS.Controllers.Controllers
{
	public class CustomersController : Controller
	{
		gimpsEntities ctx = new gimpsEntities();
		//
		// GET: /Customer/

		public ActionResult Index()
		{
			return View();
		}
		
		public JsonResult GetCustomers()
		{
			return Json((from c in ctx.customers
					select c).ToList(), JsonRequestBehavior.AllowGet);
		}

		public ActionResult Edit(int? id)
		{
			return View((from c in ctx.customers
						 where c.id == id.Value
						 select c).FirstOrDefault());
		}

		//public ActionResult Delete()
		//{
		//    return View("Index");
		//}

		//public ActionResult Create()
		//{
		//    return View(new Customer());
		//}

		//public ActionResult Insert(FormCollection form)
		//{
		//    var obj = fillObj(form);
		//    //TODO: address
		//    obj.insert();
		//    return Index();
		//}
		
		//public ActionResult Update(FormCollection form)
		//{
		//    var obj = fillObj(form);
		//    obj.Id = Convert.ToInt32(form["Id"]);
		//    //TODO: address
		//    obj.update();
		//    return Index();
		//}

		//public ActionResult Save(FormCollection form)
		//{
		//    if (!String.IsNullOrEmpty(form["Id"]))
		//        return Update(form);
		//    return Insert(form);
		//}
	}
}
